﻿function AnswerAdd(Result) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=UTF-8",
        url: "Student/Preview_Ask.aspx/AnswerAdd",
        data: "{PreviewId:'" + p + "',UserId:'" + userId + "',Result:'" + decodeURIComponent(Result) + "'}",
        dataType: "json",
        success: function (obj) {
            var data = eval('(' + obj.d + ')');
            if (!data.IsSuccess) {
                alert(data.Msg);
                if (data.Msg.indexOf("您已经登录超时") != -1) window.location.href = "/Login.aspx";
            } else {
                var listHtml = "<div id='p_view' style='padding-left:10px; padding-right:10px; color:#808080;'>";
                listHtml +=  $("#textfield").val() + "</div>";
                $("#p_add").remove();
                $(".title").after(listHtml);
            }
        },
        error: function (r, t, e) {
            alert(t);
        }
    });
}